<?php
function &mgFunc(){
    static $b = 10;
    return $b;
}
$a = mgFunc();
var_dump($a);
$a = &mgFunc();
var_dump($a);
$a = 100;
echo mgFunc();